; ModuleID = 'math.c'
source_filename = "math.c"
target triple = "unknown-unknown-unknown"

define dso_local i32 @add(i32 noundef %a, i32 noundef %b) {
entry:
  %a.addr = alloca i32, align 4
  %b.addr = alloca i32, align 4
  store i32 %a, i32* %a.addr, align 4
  store i32 %b, i32* %b.addr, align 4
  %0 = load i32, i32* %a.addr, align 4
  %1 = load i32, i32* %b.addr, align 4
  %addtmp = add nsw i32 %0, %1
  ret i32 %addtmp
}

define dso_local i32 @clamp_non_negative(i32 noundef %x) {
entry:
  %x.addr = alloca i32, align 4
  store i32 %x, i32* %x.addr, align 4
  %0 = load i32, i32* %x.addr, align 4
  %cmp = icmp slt i32 %0, 0
  br i1 %cmp, label %if.then, label %if.end

if.then:
  br label %if.end

if.end:
  %retval = phi i32 [ 0, %if.then ], [ %0, %entry ]
  ret i32 %retval
}

define dso_local i32 @compute(i1 noundef zeroext %boost, i32 noundef %value) {
entry:
  %boost.addr = alloca i1, align 1
  %value.addr = alloca i32, align 4
  %base = alloca i32, align 4
  store i1 %boost, i1* %boost.addr, align 1
  store i32 %value, i32* %value.addr, align 4
  %0 = load i32, i32* %value.addr, align 4
  %call = call i32 @clamp_non_negative(i32 %0)
  store i32 %call, i32* %base, align 4
  %1 = load i1, i1* %boost.addr, align 1
  br i1 %1, label %if.then, label %if.end

if.then:
  %2 = load i32, i32* %base, align 4
  %3 = load i32, i32* %base, align 4
  %addtmp = call i32 @add(i32 %2, i32 %3)
  br label %if.end

if.end:
  %retval = phi i32 [ %addtmp, %if.then ], [ %call, %entry ]
  ret i32 %retval
}

define dso_local i32 @main() {
entry:
  %a = alloca i32, align 4
  %b = alloca i32, align 4
  %c = alloca i32, align 4
  %total = alloca i32, align 4
  %call = call i32 @add(i32 4, i32 -1)
  store i32 %call, i32* %a, align 4
  %call1 = call i32 @compute(i1 true, i32 -3)
  store i32 %call1, i32* %b, align 4
  %call2 = call i32 @compute(i1 false, i32 5)
  store i32 %call2, i32* %c, align 4
  %0 = load i32, i32* %a, align 4
  %1 = load i32, i32* %b, align 4
  %addtmp = add nsw i32 %0, %1
  %2 = load i32, i32* %c, align 4
  %addtmp3 = add nsw i32 %addtmp, %2
  store i32 %addtmp3, i32* %total, align 4
  %3 = load i32, i32* %total, align 4
  ret i32 %3
}
